precision highp float;

uniform vec2 u_step;
uniform float u_degree;
uniform float u_radius;

attribute vec2 attPosition;
attribute vec2 attUV;

varying vec2 v_uv0;
varying vec2 v_uv[8];

#define PI 3.14159265359


void main () {
    float a = PI * u_degree;
    float s = sin(a);
    float c = cos(a);

    vec2 t = u_step * u_radius;
    mat2 m = mat2(t.x, 0.0, 0.0, t.y) * mat2(c, s, -s, c);

    v_uv0 = attUV;
    v_uv[0] = attUV + m * vec2(0.25, 0.0);
    v_uv[1] = attUV - m * vec2(0.25, 0.0);
    v_uv[2] = attUV + m * vec2(0.50, 0.0);
    v_uv[3] = attUV - m * vec2(0.50, 0.0);
    v_uv[4] = attUV + m * vec2(0.75, 0.0);
    v_uv[5] = attUV - m * vec2(0.75, 0.0);
    v_uv[6] = attUV + m * vec2(1.00, 0.0);
    v_uv[7] = attUV - m * vec2(1.00, 0.0);

    gl_Position = vec4(attPosition, 0.0, 1.0);
}